Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[keyvault-keys] Browser support, with record and playback #4343

Merged
merged 19 commits into from
Jul 19, 2019

Conversation

sadasant
Copy link
Contributor

@sadasant sadasant commented Jul 17, 2019

Everything should be working at this point! I'll review myself, clean this and follow up with another PR for keyvault-secrets.

Related to #3797

@sadasant sadasant added Client This issue points to a problem in the data-plane of the library. KeyVault labels Jul 17, 2019
@sadasant sadasant self-assigned this Jul 17, 2019
"lint:fix": "eslint -c ../../.eslintrc.json src tests samples --ext .ts --fix --fix-type [problem,suggestion]",
"lint": "eslint -c ../../.eslintrc.json src tests samples --ext .ts -f node_modules/eslint-detailed-reporter/lib/detailed.js -o keyvault-keys-lintReport.html || exit 0",
"lint:fix": "eslint --rule 'no-invalid-this: 0' -c ../../.eslintrc.json src tests samples --ext .ts --fix --fix-type [problem,suggestion]",
"lint": "eslint --rule 'no-invalid-this: 0' -c ../../.eslintrc.json src tests samples --ext .ts -f node_modules/eslint-detailed-reporter/lib/detailed.js -o keyvault-keys-lintReport.html || exit 0",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added this rule since I'm using this.title and other properties of Mocha's test prototypes in my tests.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't like having special lint rules for specific packages. Why is this rule specific to this package? Should the test code for this package instead be modified to align with other packages which don't need this special rule?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixing it!

@@ -161,6 +179,190 @@ class NockRecorder extends Recorder {
}
}

class NiseRecorder extends Recorder {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is taken as is from storage-queue.

customLaunchers: {
ChromeHeadlessNoSandbox: {
base: "ChromeHeadless",
flags: ["--no-sandbox", "--disable-web-security"]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this flag --no-sandbox required ?

Copy link
Contributor Author

@sadasant sadasant Jul 18, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't been able to make it work in my Linux machine without this.

Copy link
Member

@HarshaNalluru HarshaNalluru Jul 18, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this the same situation for storage-queue for you?
I don't recall facing any such issues with storage packages when I executed the tests on my Ubuntu sometime before.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is necessary for me on all libraries that use chrome headless 😅 I believe @daviwil knows an alternative, but I believe it changes the kernel or something.

"exclude": ["node_modules", "types/**", "./samples/**/*.ts", "./test/perf/azure-sb-package/*.ts"],
"include": ["./src/**/*.ts", "./test/**/*.ts"]
"exclude": ["node_modules", "./samples/**/*.ts"],
"include": ["./src/**/*.ts", "./tests/**/*.ts"]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[NIT]
For consistency, name of the tests folder 📂 tests -> test
servicebus, template and storage packages follow the name "test".

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is true! The only caveat is that this PR size will likely increase considerably. Can I change the name of the folder in another PR?

@mikeharder
Copy link
Member

/azp run js - keyvault-keys - tests

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@mikeharder
Copy link
Member

@sadasant: Please do not merge until we get a passing run of pipeline "js - keyvault-keys - tests" (which I manually triggered above).

@sadasant sadasant force-pushed the feature/keyVaultBrowser branch from 5f81d3f to e190f77 Compare July 18, 2019 20:12
}

public stop(): void {
for (let i = 0; i < this.recordings.length; i++) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had to add this for loop to properly filter secret values in this recorder!

@sadasant
Copy link
Contributor Author

/azp run js - keyvault-keys - tests

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@sadasant sadasant force-pushed the feature/keyVaultBrowser branch from e190f77 to 1bf81e6 Compare July 18, 2019 23:58
@sadasant
Copy link
Contributor Author

/azp run js - keyvault-keys - tests

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@@ -4,6 +4,7 @@

```ts

import { AbortSignalLike } from '@azure/abort-controller';
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I merged a test with abortSignal and I didn't spot the missing definition in the API. I'll address this in all of the other methods in another Pull Request. I made this issue to follow up on this: #4357

"tsconfig.json"
],
"browser": {
"./dist/index.js": "./browser/azure-keyvault-keys.min.js",
"./dist-esm/src/index.js": "./dist-esm/src/index.js",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this line is a no-op and should be removed. There's no point to map a file to itself.

"lint:fix": "eslint -c ../../.eslintrc.json src tests samples --ext .ts --fix --fix-type [problem,suggestion]",
"lint": "eslint -c ../../.eslintrc.json src tests samples --ext .ts -f node_modules/eslint-detailed-reporter/lib/detailed.js -o keyvault-keys-lintReport.html || exit 0",
"lint:fix": "eslint --rule 'no-invalid-this: 0' -c ../../.eslintrc.json src tests samples --ext .ts --fix --fix-type [problem,suggestion]",
"lint": "eslint --rule 'no-invalid-this: 0' -c ../../.eslintrc.json src tests samples --ext .ts -f node_modules/eslint-detailed-reporter/lib/detailed.js -o keyvault-keys-lintReport.html || exit 0",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't like having special lint rules for specific packages. Why is this rule specific to this package? Should the test code for this package instead be modified to align with other packages which don't need this special rule?

Copy link
Member

@mikeharder mikeharder left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved pending comment explaining eslint exclusion and successful live test pass. If you've already seen live tests pass and no significant changes were made since then, you don't need to wait for tests again.

@sadasant
Copy link
Contributor Author

/azp run js - keyvault-keys - tests

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@sadasant sadasant merged commit 5bb8353 into Azure:master Jul 19, 2019
@sadasant sadasant deleted the feature/keyVaultBrowser branch July 19, 2019 20:26
sadasant added a commit that referenced this pull request Jul 19, 2019
Everything should be working at this point!

This is the same work done for keyvault-keys here: #4343

Related to #3797
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Client This issue points to a problem in the data-plane of the library. KeyVault
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants